Add Date property type#836
Merged
Merged
Conversation
cf0ff43 to
03b9d1a
Compare
992f4a7 to
1087d9a
Compare
Adds a calendar `date` property type — a date with no time or timezone component — parallel to the existing `dateTime` type and distinct from the planned EDTF type. Values are strict ISO 8601 calendar dates in `YYYY-MM-DD` form. Values carrying a time/timezone component, partial values (year-only, year-month), and calendar overflows (e.g. `2025-02-30`, Feb 29 in a non-leap year) are rejected. Optional inclusive `minimum`/`maximum` bounds follow the same shape rules. Backend: - `DateType` property type and `DateProperty` schema definition, mirroring the DateTime equivalents with a date-only regex plus a `checkdate` calendar-overflow guard. - Registered in `PropertyTypeRegistry::withCoreTypes()` and as a Neo4j scalar builder in `Neo4jValueBuilderRegistry::withCoreBuilders()`. Frontend: - `Date.ts` (validation, strict parsing, locale display formatting), `dateConversion.ts` (parse-guarded `<input type="date">` wire conversion), and `DateInput` / `DateDisplay` / `DateAttributesEditor` Vue components. - Registered in `Neo.ts`, `NeoWikiExtension.ts`, and exported from `public-api.ts`. i18n: `neowiki-property-type-date` label and `neowiki-field-invalid-date` validation message, with qqq documentation and extension.json message registration. Tests: PHP `DateTypeTest`, `DatePropertyTest`, an extended Neo4j value-builder assertion, and a CodexModule icon registration guard. TS specs for the domain type, conversion helpers, and all three Vue components. Identified with Claude Code Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1087d9a to
a4da3c6
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #788
Adds a calendar
dateproperty type (a date with no time or timezone component), parallel to the existingdateTimetype (#678) and distinct from the planned EDTF type (#679).Screenshots
DateAttributesEditor(Range Minimum/Maximum) +DateInput(Initial value), all native<input type="date">.DateInputvalue editor. Native date input on the subject form, pre-populated06/15/2026, withmin/maxpulled from the schema bounds.DateDisplay.EventDaterendered as Jun 15, 2026: a<time datetime="2026-06-15">with locale-formatted text, no time/tz component.Behavior
Values are ISO 8601 calendar dates (
YYYY-MM-DD), with optional inclusiveminimum/maximumbounds of the same shape.Design note: why mirror DateTime rather than extract shared abstractions
Dateis a deliberate near-clone ofDateTime(#678): same class shape, same wire format, same registration pattern, narrower input. We considered extracting a shared base class / validation helper and chose not to, for these reasons:DateandDateTimeline up almost diff-for-diff, but the differences (value space, timezone semantics, display format) are semantic, not cosmetic. An abstraction extracted from two examples typically either erases those differences (wrong) or surfaces them as a tangle of configuration options (worse than the duplication). Two examples isn't enough to tell which similarities are essential.Datelines up with itsDateTimecounterpart 1:1, so "is anything from the DateTime follow-ups missing?" reduces to a readable diff. We confirmed all the substantive fixes from Add DateTime min/max cross-validation and generalize minExceedsMax #733, DateTime: stricter ISO 8601 value validation #734, DateTime: user-local display/input with UTC storage and semantic <time> #753, and DateTimeInput: format min/max error bounds as host-local wall-clock #770 are present.validate()body shape (required → parse → invalid-X → min → max) is structurally identical inDate,DateTime, and (with adaptation)Number; the PHPensureValidBoundOrNullpattern is the same wherever there's a bounded scalar property. These are worth lifting once there are 3+ consumers: best done as a separate follow-up, not bundled with adding the second consumer.The Vue input/display/attributes-editor trio is explicitly not a good extraction target: the duplication is shallow per file (~100 lines), the differences are the seam (
input-type, icon, conversion module, class prefix), and a generic wrapper would just move the duplication into a configuration object.Verification
vue-tsctypecheck clean.🤖 Generated with Claude Code